//package com.bookm;
//
//import com.baomidou.mybatisplus.annotation.IdType;
//import com.baomidou.mybatisplus.generator.AutoGenerator;
//import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
//import com.baomidou.mybatisplus.generator.config.GlobalConfig;
//import com.baomidou.mybatisplus.generator.config.PackageConfig;
//import com.baomidou.mybatisplus.generator.config.StrategyConfig;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Component
//public class Generator {
////    @Autowired
////    private MyDataSource myDataSource;
//
////    url: jdbc:mysql://localhost:3306/pkm?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8
////    username: root
////    password: 123456
////    driver-class-name: com.mysql.cj.jdbc.Driver
//    public static void main(String[] args) {
//        AutoGenerator autoGenerator=new AutoGenerator();
//        DataSourceConfig datasource=new DataSourceConfig();
//        datasource.setDriverName("com.mysql.cj.jdbc.Driver");
//        datasource.setUrl("jdbc:mysql://localhost:3306/pkm?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8");
//        datasource.setUsername("root");
//        datasource.setPassword("123456");
//        autoGenerator.setDataSource(datasource);
//
//        GlobalConfig globalConfig=new GlobalConfig();
////        globalConfig.setOutputDir();
////        globalConfig.setOpen(true);//默认true
////        globalConfig.setFileOverride(false);//默认false
//        globalConfig.setMapperName("%sDao");
//        globalConfig.setIdType(IdType.AUTO);
//
//
//
//        PackageConfig packageConfig=new PackageConfig();
//        packageConfig.setParent("com"); //父包
//        packageConfig.setEntity("bean"); //实体类包名
//        packageConfig.setMapper("dao");//数据层包名
//
//
//        /**
//        * 策略配置
//        */
//        StrategyConfig strategyConfig=new StrategyConfig();
//        strategyConfig.setEntityLombokModel(true);
////        strategyConfig.setInclude("user","book");//设置当前参与生成的表名
//        strategyConfig.setRestControllerStyle(true);
////        strategyConfig.setTablePrefix("")//设置数据表的前缀名,可以去掉数据表的前缀
////        strategyConfig.setVersionFieldName("version");
////        strategyConfig.setLogicDeleteFieldName("deleted");
//
//
//        autoGenerator.setStrategy(strategyConfig);
//        autoGenerator.setPackageInfo(packageConfig);
//        autoGenerator.setGlobalConfig(globalConfig);
//        autoGenerator.execute();
//
//
//    }
//}
